package linkedlist;

import linkedlist.create.RecursionLinkedCreator;
import linkedlist.delete.RecursionDeletor;
import linkedlist.iterator.RecursionIterator;
import linkedlist.reverse.RecursionReverse;

import java.util.Arrays;

/**
 * @Author wangtengyu
 * @Create 2018-09-03-14:25
 */
public class RecursionDemo {

  public static void main(String[] args) {

    RecursionLinkedCreator creator = new RecursionLinkedCreator();
    RecursionIterator iterator = new RecursionIterator();
    RecursionDeletor deletor = new RecursionDeletor();
    RecursionReverse reverse = new RecursionReverse();

    Node node = creator.createlinkedList(Arrays.asList(2, 2, 3, 4, 2, 5));
    System.out.println("遍历链表");
    iterator.iterator(node);
    System.out.println();

    System.out.println("反转链表");
    node = reverse.reverseLinkedList(node);
    iterator.iterator(node);
    System.out.println();

    System.out.println("删除集合中的元素2之后");
    node = deletor.deleteValue(node, 2);
    iterator.iterator(node);

//        Node empty= creator.createlinkedList(new ArrayList<>());
//        iterator.iterator(empty);
//        deletor.deleteValue(node,2);

  }

}
